// JavaScript Document

//############################
// ADD LEADING ZERO
//############################

function calcage(secs, num1, num2) {

  LeadingZero = true;

  s = ((Math.floor(secs/num1))%num2).toString();
  if (LeadingZero && s.length < 2)
    s = "0" + s;
  return "" + s + "";
}
   
//############################
// TIME FORMAT FOR LIVE AUCTION
//############################
  
      /*
          function testtest(id2) {
                   id3 = id2;
 DisplayStr1 = document.getElementById(id3).innerHTML;
             
DisplayStr1 = DisplayStr1.replace(".9", ".9");
             
document.getElementById(id3).innerHTML = DisplayStr1;
              
setTimeout("testtest2(id3)", 100);
   //   testtest2(id3);      
               }
               
              function testtest2(id4) {
                   
                   id5 = id4;
                         
DisplayStr2 = document.getElementById(id5).innerHTML;
             
DisplayStr2 = DisplayStr2.replace(".9", ".8");
                                                   
document.getElementById(id5).innerHTML = DisplayStr2;
              
setTimeout("testtest3(id5)", 100);

//testtest3(id5); 
               } 
                   
          function testtest3(id6) {
                   id7 = id6;
                         
DisplayStr3 = document.getElementById(id7).innerHTML;

         DisplayStr3 = DisplayStr3.replace(".8", ".7");

 document.getElementById(id7).innerHTML = DisplayStr3;

 setTimeout("testtest4(id7)", 100);
               
   //  testtest4(id7);           
               }  
               
                                     function testtest4(id8) {
                   id9 = id8;
                         
  DisplayStr4 = document.getElementById(id9).innerHTML;

         DisplayStr4 = DisplayStr4.replace(".7", ".6");

 document.getElementById(id9).innerHTML = DisplayStr4;

setTimeout("testtest5(id9)", 100);
 
 //testtest5(id9); 
               }
               
               
                                                    function testtest5(id10) {
                   id11 = id10;
                         
  DisplayStr5 = document.getElementById(id11).innerHTML;

         DisplayStr5 = DisplayStr5.replace(".6", ".5");

 document.getElementById(id11).innerHTML = DisplayStr5;

setTimeout("testtest6(id11)", 100);
               
    // testtest6(id11);          
               
               }
  
  
                           function testtest6(id12) {
                   id13 = id12;
                         
  DisplayStr6 = document.getElementById(id13).innerHTML;

         DisplayStr6 = DisplayStr6.replace(".5", ".4");

 document.getElementById(id13).innerHTML = DisplayStr6;

 setTimeout("testtest7(id13)", 100);
              
      //testtest7(id13);         
               }
  
  
                          function testtest7(id14) {
                   id15 = id14;
                         
  DisplayStr7 = document.getElementById(id15).innerHTML;

         DisplayStr7 = DisplayStr7.replace(".4", ".3");

 document.getElementById(id15).innerHTML = DisplayStr7;

setTimeout("testtest8(id15)", 100);
               
             // testtest8(id15);  
               }
  
  
  
                            function testtest8(id16) {
                   id17 = id16;
                         
  DisplayStr8 = document.getElementById(id17).innerHTML;

         DisplayStr8 = DisplayStr8.replace(".3", ".2");

 document.getElementById(id17).innerHTML = DisplayStr8;

setTimeout("testtest9(id17)", 100);
              
             //testtest9(id17);  
               }
               
                                 function testtest9(id18) {
                   id19 = id18;
                         
  DisplayStr9 = document.getElementById(id19).innerHTML;

         DisplayStr9 = DisplayStr9.replace(".2", ".1");

 document.getElementById(id19).innerHTML = DisplayStr9;

setTimeout("testtest10(id19)", 100);

//testtest10(id19); 
               }  
               
                 function testtest10(id20) {
                   id21 = id20;
                         
  DisplayStr10 = document.getElementById(id21).innerHTML;

         DisplayStr10 = DisplayStr10.replace(".1", ".0");

 document.getElementById(id21).innerHTML = DisplayStr10;


               }  */                
               
               
  function TimeFormatter(gsecs, id, reserve_price, high_bid, notimer){
              //alert(notimer);
  if ( notimer == 0 ) {
             
              daystext=document.getElementById('days_language').innerHTML;
              notsoldtext=document.getElementById('notsold_language').innerHTML;
              soldtext=document.getElementById('sold_language').innerHTML ;
              reservenotmettext=document.getElementById('reserve_language').innerHTML;
             goingoncetext=document.getElementById('goingonce_language').innerHTML;
              goingtwicetext=document.getElementById('goingtwice_language').innerHTML;
             finalcallttext=document.getElementById('finalcall_language').innerHTML;
                  takingachance=document.getElementById('takingachance_language').innerHTML;
           gsecs = gsecs - 6;   
  
if (gsecs < -9) {
    
    
    
    if ( high_bid == 0 ) {
    document.getElementById(id).innerHTML = "<font color=red>" + notsoldtext + "</font>";
    }
    
    if ( high_bid > 0 ) {
    
    if ( reserve_price < high_bid ) {
    
    document.getElementById(id).innerHTML = "<font color=red>" + soldtext + "</font>";
    }
     if ( reserve_price > high_bid ) {
   document.getElementById(id).innerHTML="<font color=red >" + reservenotmettext + "</font>";
    }
    
    } 
    
  }
      
   if (gsecs <0) {
   if (gsecs > -9 ){
    document.getElementById(id).innerHTML = " ";
    }
  }
  
          if (gsecs == 0 ){
    document.getElementById(id).innerHTML = "<font color=red>" + takingachance + "</font>";

  } 
  
  
          if (gsecs == 1 ){
    document.getElementById(id).innerHTML = "<font color=red>" + takingachance + "</font>";

  } 
  
  
  if (gsecs == 2 ){
    document.getElementById(id).innerHTML = "<font color=red>" + takingachance + "</font>";

  } 
  
  if (gsecs == 3 ){
    document.getElementById(id).innerHTML = "<font color=red>" + goingtwicetext + "</font>";

  }  
 if (gsecs == 4 ){
    document.getElementById(id).innerHTML = "<font color=red>" + goingoncetext + "</font>";

  } 
  
  if (gsecs == 5) {
    document.getElementById(id).innerHTML = "<font color=red>" + finalcallttext + "</font>";

  }
       /*
if (gsecs == 6) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + goingoncetext + "</font>";

  } 
                                                                 
    if (gsecs == 7) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + goingoncetext + "</font>";
 
  }
  
    if (gsecs == 8) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + finalcallttext + "</font>";
            }
       
           if (gsecs == 9) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + finalcallttext + "</font>";
               }
                  
                     */
              
  var days=calcage(gsecs,86400,100000);
  
if (days != 00) {


//DisplayFormat = "%%D%% " + daystext + " <BR> %%H%%:%%M%%:%%S%%.%%SS%%";
 DisplayFormat = "%%D%% " + daystext + " <BR> %%H%%:%%M%%:%%S%%";
  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(gsecs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));
   //DisplayStr = DisplayStr.replace(/%%SS%%/g, '9');
if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
           
  }

if (gsecs < 31 && gsecs > 5) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
             //testtest(id);
  }


}

    
if (days == 00) {

//DisplayFormat2 = "<BR>%%H%%:%%M%%:%%S%%.%%SS%%";
    DisplayFormat2 = "<BR>%%H%%:%%M%%:%%S%%";
  DisplayStr = DisplayFormat2.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));
   // DisplayStr = DisplayStr.replace(/%%SS%%/g, '9');

if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
          // testtest(id);
  }
  
  if (gsecs < 31 && gsecs > 5) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
         // testtest(id);
  }
  
    }     
         
//(new Spry.Effect.Highlight(document.getElementById(id), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();
          
        
     }       
   
   
    if ( notimer == 1 ) {
    document.getElementById(id).innerHTML = " ";
         //alert(notimer);
    }
   
   }         

//############################
// TIME FORMAT FOR UPCOMING AUCTION
//############################

function HoldingTimeFormatter(gsecs, id){

          daystext=document.getElementById('days_language').innerHTML;
          nowopentext=document.getElementById('nowopen_language').innerHTML;
            gotext=document.getElementById('go_language').innerHTML;
             getsettext=document.getElementById('getset_language').innerHTML;
              onyourmarktext=document.getElementById('onyourmark_language').innerHTML;
          
         
         
         if (gsecs == -4) {
    document.getElementById(id).innerHTML = "<font color=red>" + nowopentext + "</font>";

  }
         
          if (gsecs == -3) {
    document.getElementById(id).innerHTML = "<font color=red>" + nowopentext + "</font>";

  } 
           if (gsecs == -2) {
    document.getElementById(id).innerHTML = "<font color=red>" + nowopentext + "</font>";

  }if (gsecs == -1) {
    document.getElementById(id).innerHTML = "<font color=red>" + nowopentext + "</font>";

  }if (gsecs == 0) {
    document.getElementById(id).innerHTML = "<font color=red>" + nowopentext + "</font>";

  }if (gsecs == 1) {
    document.getElementById(id).innerHTML = "<font color=red>" + nowopentext + "</font>";

  }
           
           
if (gsecs == 2) {
    document.getElementById(id).innerHTML = "<font color=red>" + nowopentext + "</font>";

  }
  
  if (gsecs == 3) {
    document.getElementById(id).innerHTML = "<font color=red>" + gotext + "</font>";

  }
  
  if (gsecs == 4 ){
    document.getElementById(id).innerHTML = "<font color=red>" + getsettext + "</font>";

  }
  
 
 
 if (gsecs == 5) {
    document.getElementById(id).innerHTML = "<font color=red>" + onyourmarktext + "</font>";

  }
 
    var days=calcage(gsecs,86400,100000);
  
if (days != 00) {


DisplayFormat = "%%D%% " + daystext + ", %%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(gsecs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));



  document.getElementById(id).innerHTML = DisplayStr;
  



}

    
if (days == 00) {

DisplayFormat2 = "%%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat2.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));


if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  
  }
  
 if (gsecs < 31 && gsecs > 5) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }
  
    }     
         
//(new Spry.Effect.Highlight(document.getElementById(id), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();


        
}


//############################
// TIME FORMAT FOR ITEM PAGE
//############################
   
   
   function ItemTimeFormatter(gsecs, id){
          pausedtext1=document.getElementById('pausedtext').innerHTML;
   pausedon=document.getElementById('paused').innerHTML;
                                       
                      daystext=document.getElementById('days_language').innerHTML;
              notsoldtext=document.getElementById('notsold_language').innerHTML;
              soldtext=document.getElementById('sold_language').innerHTML;
              reservenotmettext=document.getElementById('reserve_language').innerHTML;
             goingoncetext=document.getElementById('goingonce_language').innerHTML;
              goingtwicetext=document.getElementById('goingtwice_language').innerHTML;
             finalcallttext=document.getElementById('finalcall_language').innerHTML;
                 takingachance=document.getElementById('takingachance_language').innerHTML;

gsecs = gsecs - 6;   

 
if ( pausedon == 1 ){

   document.getElementById(id).innerHTML = "<font color=red>" + pausedtext1 + "</font>";
   return;
} 
 
  
if (gsecs < -9) {
    
if ( high_bid == 0 ) {
    document.getElementById(id).innerHTML = "<font color=red>" + notsoldtext + "</font>";
    }
    
    if ( high_bid > 0 ) {
    
    if ( reserve_price < high_bid ) {
    
    document.getElementById(id).innerHTML = "<font color=red>" + soldtext + "</font>";
    }
     if ( reserve_price > high_bid ) {
   document.getElementById(id).innerHTML="<font color=red >" + reservenotmettext + "</font>";
    }
    
    } 
    
  }
      
   if (gsecs < 0) {
   if (gsecs > -9 ){
    document.getElementById(id).innerHTML = " ";
    }
  }
       if (gsecs == 0 ){
    document.getElementById(id).innerHTML = "<font color=red>" + takingachance + "</font>";

  } 
  
  
          if (gsecs == 1 ){
    document.getElementById(id).innerHTML = "<font color=red>" + takingachance + "</font>";

  } 
  
  
  if (gsecs == 2 ){
    document.getElementById(id).innerHTML = "<font color=red>" + takingachance + "</font>";

  } 
  
  if (gsecs == 3 ){
    document.getElementById(id).innerHTML = "<font color=red>" + goingtwicetext + "</font>";

  }  
 if (gsecs == 4 ){
    document.getElementById(id).innerHTML = "<font color=red>" + goingoncetext + "</font>";

  } 
  
  if (gsecs == 5) {
    document.getElementById(id).innerHTML = "<font color=red>" + finalcallttext + "</font>";

  }
       /*
if (gsecs == 6) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + goingoncetext + "</font>";

  } 
                                                                 
    if (gsecs == 7) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + goingoncetext + "</font>";
 
  }
  
    if (gsecs == 8) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + finalcallttext + "</font>";
            }
       
           if (gsecs == 9) {
    document.getElementById(id).innerHTML = "<font color=red><BR>" + finalcallttext + "</font>";
               }
                  
                     */
                  
  var days=calcage(gsecs,86400,100000);
  
if (days != 00) {


DisplayFormat = "%%D%% " + daystext + ", %%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(gsecs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));

if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  }

if (gsecs < 31 && gsecs > 5) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }


}

    
if (days == 00) {

DisplayFormat2 = "%%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat2.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));


if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  
  }
  
  if (gsecs < 31 && gsecs > 5) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }
  
    }     
         
//(new Spry.Effect.Highlight(document.getElementById(id), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();
//ItemTimeFormatter(gsecs,'time');

        
}


//############################
// Button Change
//############################

function button (img_name,img_src) {
document[img_name].src=img_src;
                }
                
                
                


//############################
// ITEM PAGE AJAX
//############################
                     

function itemPageInfo(ajaxid, TimeoutCount1)
{



        


TimeoutCount2 = ++TimeoutCount1;

if ( TimeoutCount2 == 2000 )  {

 result=document.getElementById('inactivity_language').innerHTML;

TINY.box.show(result,0,0,0,0,86400)

}

if ( TimeoutCount2 > 2005 )  {

TimeoutCount2 = 0;

}


       

var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
 
 //alert(ajaxid);
       
var x1 = xmlhttp.responseText;

var x2=x1.split("|"); 
  
  bids_remaining = x2[1];
  //currenttime5 = new Date(x2[2]);
  // alert(currenttime5);      
  //end_time = new Date(x2[3]);
  reserve_price = x2[4];
  reserve_price = reserve_price * 1.00;
  page_counter = x2[5];
  high_bidder = x2[6];
  //alert(high_bidder);
  high_bid = x2[7];
  number_of_bids = x2[8];
  
     avatar = x2[9];
         // alert(avatar);
      
           seatstaken = x2[10];
      // alert(seatstaken);    
       min5 = x2[11];
     //alert(min5);
  
  
  bidder1 = x2[12];
  //alert(bidder1);
  bidamount1 = x2[13];
    time1 = x2[14];
  bidtype1 = x2[15];
  
  
    bidder2 = x2[16];
  bidamount2 = x2[17];
    time2 = x2[18];
   bidtype2 = x2[19];
  
  
    bidder3 = x2[20];
  bidamount3 = x2[21];
    time3 = x2[22];
     bidtype3 = x2[23];
  
  
    bidder4 = x2[24];
  bidamount4 = x2[25];
    time4 = x2[26];
        bidtype4 = x2[27];
  
  
    bidder5 = x2[28];
  bidamount5 = x2[29];
    time5 = x2[30];
      bidtype5 = x2[31];
    
    
       
       
    
    
    /* autobidderbids = x2[24]; */
          if(high_bidxx == 'x') {


high_bidxx = high_bid;

 }


if(high_bidxx < high_bid) {

    
     
      (new Spry.Effect.Highlight(document.getElementById('ITEM_CURRENT_BID1'), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();      
  
                    high_bidxx = high_bid;

                 }                 
                              
      if ( bids_remaining != 'A' ) { 
       //alert(bids_remaining); 
       if ( bids_remaining != undefined ) {   
   document.getElementById('BIDSID').innerHTML=bids_remaining; 
   } 
   
      
                                  }      
    
    
  var reserve_symbol=document.getElementById('reserve_currency_symbol_get').innerHTML
             
               if ( reserve_price > 0 ) {
             
              if ( reserve_price > high_bid ) {
                     
              reserve_price3 = reserve_price.toFixed(2);
                     

   document.getElementById('item_reserve_price').innerHTML="<font color=red >Reserve Price: " +reserve_symbol+ "" +reserve_price3+ "<BR>Reserve Not Met</font>";
                         } 
            if ( reserve_price < high_bid ) {
                
                     reserve_price3 = reserve_price.toFixed(2);
	
   document.getElementById('item_reserve_price').innerHTML="<font color=#5B8902 >Reserve Price: " +reserve_symbol+ "" +reserve_price3+ "<BR>Reserve Lifted</font>";
                         }
    
                               }
          
          if ( high_bid != undefined ) {
                  
document.getElementById('itemcurrentbid1').innerHTML=high_bid; 
  
  }
             
              if ( high_bidder != undefined ) {
 document.getElementById('item_current_bidder1').innerHTML=high_bidder;
                    }
                    
          if ( page_counter != undefined ) {          
  document.getElementById('counter1').innerHTML=page_counter; 
                                }
                                
           if ( number_of_bids != undefined ) {                     
   document.getElementById('bids2').innerHTML=number_of_bids; 
                    }
    
   
        /*  if ( autobidderbids != 'login' )  {
          
          
        autobidderbidscheck=document.forms['conf'].maxbids.value
      
    if ( autobidderbidscheck != autobidderbids ) {
                               
    document.forms['conf'].maxbids.value=autobidderbids;
                              
                                                           
                               }
                               
                               }
          $avatar_img                          */         
              
              
            // alert(document['avatar1'].src); 
    if ( avatar != undefined ) {
                                  
               document['avatar1'].src=avatar;
    
        } 
             
                
          if ( min5 != undefined ) {
    
  document.getElementById('5min5').innerHTML=min5;
  
  }    
  
  
            if ( seatstaken != undefined ) {
    
  document.getElementById('seatstaken1').innerHTML=seatstaken;
  
  }        
    
    
    if ( bidder1 != undefined ) {
    
  document.getElementById('bidder11').innerHTML=bidder1;
  
  }
  
  if ( bidamount1 != undefined ) {
  
  document.getElementById('bidamount11').innerHTML=bidamount1;
  }
  
  if ( time1 != undefined ) {
  
  document.getElementById('time11').innerHTML=time1;
  }
  
    if ( bidtype1 != undefined ) {
  
  document.getElementById('bidtype11').innerHTML=bidtype1;
  }
  
  
    if ( bidder2 != undefined ) {
    
  document.getElementById('bidder22').innerHTML=bidder2;
  
  }
    if ( bidamount2 != undefined ) {
  document.getElementById('bidamount22').innerHTML=bidamount2;
  
    }
  
  if ( time2 != undefined ) {
  
  document.getElementById('time22').innerHTML=time2;
  
  }
  
    if ( bidtype2 != undefined ) {
  
  document.getElementById('bidtype22').innerHTML=bidtype2;
  }
  
  
  
      if ( bidder3 != undefined ) {
    
  document.getElementById('bidder33').innerHTML=bidder3;
  
    }
      if ( bidamount3 != undefined ) {
  document.getElementById('bidamount33').innerHTML=bidamount3;
  
    }
  
  if ( time3 != undefined ) {
  
  document.getElementById('time33').innerHTML=time3;
  }
  
     if ( bidtype3 != undefined ) {
  
  document.getElementById('bidtype33').innerHTML=bidtype3;
  }
  
  
  
      if ( bidder4 != undefined ) {
    
  document.getElementById('bidder44').innerHTML=bidder4;
  
  }
  
    if ( bidamount4 != undefined ) {
  document.getElementById('bidamount44').innerHTML=bidamount4;
  
    }
  
  if ( time4 != undefined ) {
  
  document.getElementById('time44').innerHTML=time4;
  }
  
    if ( bidtype4 != undefined ) {
  
  document.getElementById('bidtype44').innerHTML=bidtype4;
  }
  
  
      if ( bidder5 != undefined ) {
    
  document.getElementById('bidder55').innerHTML=bidder5;
  
  }
    if ( bidamount5 != undefined ) {
  document.getElementById('bidamount55').innerHTML=bidamount5;
    }
  
  if ( time5 != undefined ) {
  document.getElementById('time55').innerHTML=time5;
  
   }
       if ( bidtype5 != undefined ) {
  
  document.getElementById('bidtype55').innerHTML=bidtype5;
  }
  
    
  
  }
  
}

 

ajaxurl = "cronfiles/item_page_ajax" +ajaxid+ ".txt";

xmlhttp.open("GET",ajaxurl,true);
xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
xmlhttp.send(null);


ajaxid2 = ajaxid;

setTimeout("itemPageInfo(ajaxid2,TimeoutCount2)", 1000);

  }           

//############################
// ITEM PAGE AJAX
//############################

        
function itemPageClock(ajaxid)
{


var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {


var y1 = xmlhttp.responseText;
var y2=y1.split("|"); 
currenttime5 = new Date(y2[0]);
startpos1 = y1.search(ajaxid);
endpos1 = 100;
z1=y1.substr(startpos1,endpos1);
var z2=z1.split("|"); 
end_time = new Date(z2[2]);
  
       //alert(y1);
     //alert(z2[2]);
     //alert(currenttime5);
   
    document.getElementById('currenttimee').innerHTML=currenttime5;
     document.getElementById('endtimee').innerHTML=end_time;
    
  }
  
}

 

ajaxurl = "cronfiles/get_time2.txt";

xmlhttp.open("GET",ajaxurl,true);
xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
xmlhttp.send(null);


ajaxid2 = ajaxid;

setTimeout("itemPageClock(ajaxid2)", 1000);


  }




///############################
// ITEM PAGE CLOCK LIVE
//############################                
                
         high_bidxx = 'x';



function ItemCountdownTimer(currenttime1, auctionendtime, timecount1, timecount3, timeOutCount1) {
currenttime1 = new Date(currenttime1);
secondsnow1 = currenttime1.getSeconds();
currenttime11 = currenttime1;
secondslater1 = secondsnow1 + 1;
currenttime11.setSeconds(secondslater1);
var dthen = new Date(auctionendtime); 
var dnow = currenttime11;  
ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
auctiontimeend = auctionendtime; 
/*alert(auctiontimeend); */ 

/* setTimeout("ItemCountdownTimer(currenttime11, auctiontimeend)", 1000); */

timecount2 = ++timecount1;
timecount4 = ++timecount3;      
timeOutCount2 = ++timeOutCount1
        
//currenttime55=document.getElementById('currenttimee').innerHTML;
//end_time55=document.getElementById('endtimee').innerHTML;
currenttime55=currenttime1;
end_time55=auctionendtime;
      //alert(currenttime55);
    //alert(end_time55);
   
if ( gsecs > 8 ) {
            if ( timecount2 > 15 ) {
            
                   timecount2 = 0;
                   currenttime11 = currenttime55;
                  //alert(currenttime5);           
            }
          }  
                  
  //alert(timecount2);
if( timecount4 == 60 ) {


//window.location.reload();


}    

//echo "123";
//alert(end_time55);
setTimeout("ItemCountdownTimer(currenttime11, end_time55, timecount2, timecount4, timeOutCount2)", 1000);


ItemTimeFormatter(gsecs, 'time'); 

   loggedin1 = document.getElementById('loggedin').innerHTML;


   if ( loggedin1 > 0 ) { 
   
   bidbidbid = document.getElementById('iibbhidden').onclick;
   bidbidbid2 = document.getElementById('iibbhidden').onmouseover;
   bidbidbid3 = document.getElementById('iibbhidden').onmouseout;  
if ( gsecs > 5 ) {

document.getElementById('iibb').onclick=bidbidbid;
document.getElementById('iibb').onmouseover=bidbidbid2;
document.getElementById('iibb').onmouseout=bidbidbid3;

}
 }

if ( gsecs < 6 ) {
bidbutton3graphic=document.getElementById('large_button3').innerHTML;

document.getElementById('iibb').onclick=" ";
document.getElementById('iibb').onmouseover=" ";
document.getElementById('iibb').onmouseout=" ";
document['ibb'].src=bidbutton3graphic;
}



if( gsecs < -4 ) {
bidbutton6graphic=document.getElementById('large_button6').innerHTML;
document.getElementById('iibb').onclick=" ";
document.getElementById('iibb').onmouseover=" ";
document.getElementById('iibb').onmouseout=" ";
document['ibb'].src=bidbutton6graphic;
          }
if( gsecs < -60) {
if ( gsecs > -63 ) {

cron();
          }
                    }



}
                  
                  


//############################
// ITEM PAGE CLOCK UPCOMING
//############################                
                
         high_bidxx = 'x';



function UpcomingItemCountdownTimer(currenttime1, auctionendtime, timecount1) {
currenttime1 = new Date(currenttime1);
secondsnow1 = currenttime1.getSeconds();
currenttime11 = currenttime1;
secondslater1 = secondsnow1 + 1;
currenttime11.setSeconds(secondslater1);
var dthen = new Date(auctionendtime); 
var dnow = currenttime11;  
ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
auctiontimeend = auctionendtime; 
/*alert(auctiontimeend); */ 

/* setTimeout("ItemCountdownTimer(currenttime11, auctiontimeend)", 1000); */

timecount2 = ++timecount1;
 end_time=auctionendtime;

 if ( gsecs == 0 ){
    
      location.reload(true);
        return;
    } 

setTimeout("UpcomingItemCountdownTimer(currenttime11, end_time, timecount2)", 1000);
     
    
     
    
    
HoldingTimeFormatter(gsecs, 'time'); 



}






//############################
// ITEM BID AJAX
//############################
                              
function bid(bidid)
{

            zero_bid_notice1=document.getElementById('zero_bid_notice').innerHTML;
         auction_payment_notice1=document.getElementById('auction_payment_notice').innerHTML;
           var frontpage_bids_remaining=document.getElementById('BIDSID').innerHTML;





      paused1=document.getElementById('paused').innerHTML;
if ( paused1 == 1 ) {

return;
}


var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
 
    dailylimittext=document.getElementById('daily_limit_language').innerHTML;
    weeklylimittext=document.getElementById('weekly_limit_language').innerHTML;
    monthlylimittext=document.getElementById('monthly_limit_language').innerHTML;
    beginnerlimittext=document.getElementById('beginning_limit_language').innerHTML;
     elitelimittext=document.getElementById('elite_limit_language').innerHTML;
      lockouttext=document.getElementById('lockout_language').innerHTML;
      seatsfulltext=document.getElementById('seatsfull_language').innerHTML;
     bidbutton5graphic=document.getElementById('large_button5').innerHTML;
	 location.reload(true);
    
  /* if ( gsecs > 3 ) {
document['ibb'].src=bidbutton5graphic;
} */
 
         var bidposted = xmlhttp.responseText;
         
  if ( bidposted == 'daily' ) { 
  
  alert (dailylimittext);
    
  }   
     
   if ( bidposted == 'weekly' ) { 
  
  alert (weeklylimittext);
    
  }       
     
      if ( bidposted == 'monthly' ) { 
  
  alert (monthlylimittext);
    
  }         
  
        if ( bidposted == 'beginner' ) { 
  
  alert (beginnerlimittext);
    
  }   
  
          if ( bidposted == 'elite' ) { 
  
  alert (elitelimittext);
    
  }   
  
            if ( bidposted == 'lockout' ) { 
  
  alert (lockouttext);
    
  }  
  
  
              if ( bidposted == 'seatsfull' ) { 
  
  alert (seatsfulltext);
    
  }  
  
  
   if ( bidposted == 'unpaid' ) { 
  
  alert (auction_payment_notice1);
    
  }    
  
  
  if ( bidposted == 'nobids' ) { 
  
  alert (zero_bid_notice1);
    
  }    
  
  
  /*
   var frontpage_bids_remaining=document.getElementById('BIDSID').innerHTML;
   if ( frontpage_bids_remaining > 0 ) {
  var frontpage_bids_remaining2= frontpage_bids_remaining - 1;
  document.getElementById('BIDSID').innerHTML=frontpage_bids_remaining2;
    
    
    
     } */
     
   
                               
                                   
  }
}
bidurl = "bid.php?id=" +bidid+ "";
xmlhttp.open("GET",bidurl,true);
//xmlHttp.onreadystatechange = MyFunc;
xmlhttp.send(null);
/*if (xmlHttp.readyState == 0) location.reload(true);
if (xmlHttp.readyState == 1) location.reload(true);
if (xmlHttp.readyState == 2) location.reload(true);
if (xmlHttp.readyState == 3) location.reload(true);
if (xmlHttp.readyState == 4) location.reload(true);*/
//if (xmlHttp.status == 200) location.reload(true);
}

       
//############################
// FRONTPAGE BID AJAX
//############################
                              
function frontpagebid(auctionid,boxid)
{
                            zero_bid_notice1=document.getElementById('zero_bid_notice').innerHTML;
         auction_payment_notice1=document.getElementById('auction_payment_notice').innerHTML;
var frontpage_bids_remaining=document.getElementById('BIDSID').innerHTML;
var auctionid2=document.getElementById(auctionid).innerHTML; 
var auctionbox=document.getElementById(boxid).innerHTML;

        



 //if ( frontpage_bids_remaining > -1 ) {
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
                dailylimittext=document.getElementById('daily_limit_language').innerHTML;
    weeklylimittext=document.getElementById('weekly_limit_language').innerHTML;
    monthlylimittext=document.getElementById('monthly_limit_language').innerHTML;
    beginnerlimittext=document.getElementById('beginning_limit_language').innerHTML;
     elitelimittext=document.getElementById('elite_limit_language').innerHTML;
     bidbutton5front=document.getElementById('bidbutton5frontdiv').innerHTML;
        lockouttext=document.getElementById('lockout_language').innerHTML;
      seatsfulltext=document.getElementById('seatsfull_language').innerHTML;
    
    button (auctionbox,bidbutton5front);
      
var yy1 = xmlhttp.responseText;
var yy2=yy1.split("|"); 
var bidposted = yy2[0];
var bidreqd = yy2[1];
 
  
      if ( bidposted == 'yes' ) { 
  var frontpage_bids_remaining=document.getElementById('BIDSID').innerHTML;
  
 
   if ( frontpage_bids_remaining > 0 ) {
  var frontpage_bids_remaining2= frontpage_bids_remaining - bidreqd;
  document.getElementById('BIDSID').innerHTML=frontpage_bids_remaining2;
 /* document.getElementById('BIDSID2').innerHTML=frontpage_bids_remaining2;*/
  
     }
     }
     
     
   if ( bidposted == 'daily' ) { 
  
  alert (dailylimittext);
    
  }   
     
   if ( bidposted == 'weekly' ) { 
  
  alert (weeklylimittext);
    
  }       
     
      if ( bidposted == 'monthly' ) { 
  
  alert (monthlylimittext);
    
  }         
  
        if ( bidposted == 'beginner' ) { 
  
  alert (beginnerlimittext);
    
  }         
           if ( bidposted == 'elite' ) { 
  
  alert (elitelimittext);
    
  }     
               if ( bidposted == 'lockout' ) { 
  
  alert (lockouttext);
    
  }  
  
  
              if ( bidposted == 'seatsfull' ) { 
  
  alert (seatsfulltext);
    
  }       
  
  if ( bidposted == 'nobids' ) { 
  
  alert (zero_bid_notice1);
    
  }  
  
              if ( bidposted == 'unpaid' ) { 
  
  alert (auction_payment_notice1);
    
  }    
     
  }
}
bidurl = "bid.php?id=" +auctionid2+ "";
xmlhttp.open("GET",bidurl,true);
xmlhttp.send(null);

  //}
}



//############################
// RUN AUCTION FINALIZATION CRON.PHP
//############################
                              
function cron()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {

  }
}
url = "cron.php";
xmlhttp.open("GET",url,true);
xmlhttp.send(null);


}



//############################
// DROP DOWN SELECT CATEGORY MENU
//############################
        
function openURL()
{

      // grab index number of the selected option
      selInd = document.categorypulldown.category.selectedIndex;

      // get value of the selected option
      goURL = document.categorypulldown.category.options[selInd].value;

      // redirect browser to the grabbed value (here a URL)
      top.location.href = goURL;

}



//############################
// Bid Reamining
//############################
                        
function bidsremaining(ajaxid)
{



var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {

 
  var x5 = xmlhttp.responseText;

var x3=x5.split("|"); 
  
  bids_remaining = x3[1];
  autobidderbids = x3[2];
  savings_current_bid = x3[3]; 
  savings_bid_credit_text = x3[4];
  savings_bid_credit_data = x3[5];
  savings_shipping_data = x3[6];
  savings_total_data = x3[7];
  buynow_bid_credit_text = x3[8];
  buynow_bid_credit_data = x3[9];
  buynow_shipping_data = x3[10];
  buynow_total_data = x3[11];
  
    document.getElementById('savings_current_bid2').innerHTML=savings_current_bid;
   document.getElementById('savings_bids_text2').innerHTML=savings_bid_credit_text;
    document.getElementById('savings_bids_total2').innerHTML=savings_bid_credit_data;
      document.getElementById('savings_tsh2').innerHTML=savings_shipping_data;
      document.getElementById('savings_total').innerHTML=savings_total_data;
     document.getElementById('buynow_bids_text2').innerHTML=savings_bid_credit_text;   
    document.getElementById('buynow_bids_total2').innerHTML=savings_bid_credit_data;    
      document.getElementById('buynow_tsh2').innerHTML=buynow_shipping_data;
          document.getElementById('buynow_total').innerHTML=buynow_total_data;
 
  
     if ( bids_remaining != 'A' ) { 
       //alert(bids_remaining); 
       if ( bids_remaining != undefined ) {   
   document.getElementById('BIDSID').innerHTML=bids_remaining; 
   } 
   
   }
 
      if ( autobidderbids != 'login' ) { 
       //alert(bids_remaining); 
       if ( autobidderbids != undefined ) {   
   document.forms['conf'].maxbids.value=autobidderbids;
   } 
   
   }
   
    if ( autobidderbids == 'login' ) { 
       //alert(bids_remaining); 
      
   document.forms['conf'].maxbids.value='login';
    
   
   }
                                               
 
          // document.forms['conf'].maxbids.value=autobidderbids;
           //alert(autobidderbids);
  }
}


bidsremainingurl = "bids_remaining_ajax.php?id=" +ajaxid+ "";
xmlhttp.open("GET",bidsremainingurl,true);
xmlhttp.send(null);

    ajaxid2 = ajaxid;

setTimeout("bidsremaining(ajaxid2)", 10000);


}

//############################
// ITEM PAGE CLOCK CLOSED
//############################                
 

function ItemCountdownTimerClosed() {
          
  reserve_price = document.getElementById('closed_reserve').innerHTML;
      
        reserve_price = reserve_price * 1;
 
  high_bid = document.getElementById('closed_bid').innerHTML;        
          
    high_bid = high_bid * 1; 
    
    //alert(high_bid);
    //alert(reserve_price);
    
    //if ( high_bid > reserve_price ) {
    
    //alert('true');
    //}    
          
             daystext=document.getElementById('days_language').innerHTML;
              notsoldtext=document.getElementById('notsold_language').innerHTML;
              soldtext=document.getElementById('sold_language').innerHTML ;
              reservenotmettext=document.getElementById('reserve_language').innerHTML;
             goingoncetext=document.getElementById('goingonce_language').innerHTML;
              goingtwicetext=document.getElementById('goingtwice_language').innerHTML;
             finalcallttext=document.getElementById('finalcall_language').innerHTML;
              closedbuttonimage=document.getElementById('large_button6').innerHTML;
          
    if ( high_bid == 0 ) {
    document.getElementById('time').innerHTML = "<font color=red>" + notsoldtext + "</font>";
    }
    
    if ( high_bid > 0 ) {
    
    if ( reserve_price < high_bid ) {
    
    document.getElementById('time').innerHTML = "<font color=red>" + soldtext + "</font>";
    }
     if ( reserve_price > high_bid ) {
   document.getElementById('time').innerHTML="<font color=red >" + reservenotmettext + "</font>";
    }
    
    } 
    
document.getElementById('iibb').onclick=" ";
document.getElementById('iibb').onmouseover=" ";
document.getElementById('iibb').onmouseout=" ";
document['ibb'].src=closedbuttonimage;

  

}



 